package com.interview.service.impl;

import com.interview.dao.CommentMapper;
import com.interview.pojo.Comment;
import com.interview.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("Comment_Service_Impl")
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    // 添加评论
    @Override
    public void add(Comment comment) {
     commentMapper.insertSelective(comment);
    }

    //查询一级评论
    @Override
    public  List<Comment>  comment_select(String their) {
        return  commentMapper.comment_select(their);
    }

    //查询评论下的所有回复
    @Override
    public List<Comment> comment_select_son(String their, String reply_id) {
        return commentMapper.comment_select_son(their,reply_id);
    }

    @Override
    public int count() {
        return commentMapper.count();
    }

}
